<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="../../static/BOSGeo/BOSGeo.css" />
  <title>加载模型</title>
  <style>
    html {
      font-size: 12px;
    }

    html,
    body,
    #mapContainer {
      height: 100%;
      width: 100%;
      padding: 0;
      margin: 0;
    }

  </style>
</head>

<body>
  <div id="mapContainer"></div>
  <script src="../../static/BOSGeo/BOSGeo.js"></script>
  <script>
    var map = new BOSGeo.Map('mapContainer', {
    mapType: BOSGeo.TDT_IMAGERY,
    enableHighlight: true // 是否高亮选中的模型
    });
    // 获取图层管理类
    var layers = map.layers;
    // 设置收集模型的集合
    var modelCollection = new BOSGeo.LayerCollection({
    name: '模型集合',
    type: 'model'
    });
    // 将集合添加到图层管理中
    layers.add(modelCollection);

    var tiles = new BOSGeo.ModelLayer({
    name: '油罐4',
    type: '3dtiles',
    url: 'http://canyou.rickricks.com:8093/G1573638569291/tileset.json',
    position: [121.46517, 31.16734, 3],
    rotation: [0, 0, 0],
    enableCache: true,
    scale: 1,
    // onClick: layer => {
    //     layer.zoomTo();
    // },
    loaded: tileLoaded
});
modelCollection.add(tiles);
function tileLoaded (tileset) {
    // let axis = new BOSGeo.MeasureAxis({model: tileset, x: false, width: 1, alpha: 0.1});
    // axis.showAxis(); // 添加坐标轴
    // axis.showCube(); // 添加包围盒
    map.flyToEntity(tileset, {duration: 1.6});
}
  </script>
</body>

</html>